﻿"use strict";

angular.module('ecDashboard').directive('ecWidgetBody',
    ['$compile',
        function ($compile) {
        return {
            templateUrl: '/ext-modules/ecDashboard/ecWidgetBodyTemplate.html',
            link: function (scope,element,attr) {
                var newElement = angular.element(scope.item.template);
                element.append(newElement);
                $compile(newElement)(scope);

                scope.close = function (widget) {
                    scope.widgets.splice(scope.widgets.indexOf(widget), 1);
                }
            }
        };
    }]);